import request from '@/utils/request'

// 新增部门
/**
 * 新增部门
* @param { code, introduce,manager,name,pid} data
* @return
*/
export function addDepartments(data) {
  return request({
    url: '/company/department',
    method: 'post',
    data // 请求体body
  })
}

/**
 *获取所有的部门
 *@returns
 */
export function getDepartments() {
  return request({
    url: '/company/department',
    method: 'get'
  })
}

/**
 *修改部门
 @param { code, introduce,manager,name,pid} data
* @return
 */
export function updateDepartments(data) {
  return request({
    url: `/company/department/${data.id}`,
    method: 'put',
    data
  })
}

/**
 *删除指定部门
 *@returns
 */
export function delDepartments(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'delete'
  })
}

/**
 *查询部门
 *@returns
 */
export function getDepartmentDetail(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'get'
  })
}

